<?php if (empty($this->pid)):?>
<div id="productDialog" title="Product Photos Error">
	<p>
		<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
		Product not selected!<br />
		<b>Please select product for action!</b>
	</p>
</div>
<script type="text/javascript">
$("#productDialog").dialog({
	bgiframe: true,
	modal: true,
	autoOpen: true,
	buttons: {
		Ok: function() {
			$(this).dialog('close');
			document.location.href = '/catalog/products/list';
		}
	}
});
</script>
<?php else:?>
<style type="text/css">
	#photos { width:700px;margin:10px auto; }
	#photos dl { margin:5px 3px; float:left; }
	#photos dd { margin:0;}
	#photos dd ul { list-style:none; margin:0; padding:0;}
	#photos dd ul li { cursor:pointer; float:left; list-style:none outside none; margin:2px; padding:4px 0; position:relative; }
	#photos dd ul li span.ui-icon { float:left; margin:0 4px; }
</style>

<?php echo $this->render('form.phtml');?>

<div id="photos">
<?php foreach ($this->photos as $photo):?>
	<dl>
		<dt>
			<img class="<?php if ($photo->PHOTOS_ISDEFAULT):?>ui-state-active<?php else:?>ui-state-default<?php endif;?>" src="/timthumb/timthumb.php?src=<?php echo $photo->PHOTOS_FILE;?>&h=120&w=120&zc=0" />
		</dt>
		<dd>
			<ul class="ui-helper-clearfix">
				<li class="<?php if ($photo->PHOTOS_ISDEFAULT):?>ui-state-hover<?php else:?>ui-state-default<?php endif;?> ui-corner-all">
					<a href="/catalog/photos/defaultphoto/id/<?php echo $photo->PHOTOS_ID;?>" title="Set this photo as main"><span class="ui-icon ui-icon-star"></span></a>
				</li>
				<li class="ui-state-default ui-corner-all">
					<a href="/catalog/photos/delete/id/<?php echo $photo->PHOTOS_ID;?>" title="Delete this photo"><span class="ui-icon ui-icon-trash"></span></a>
				</li>
			</ul>
		</dd>
	</dl>
<?php endforeach;?>
</div>

<?php endif;?>